package com.lc.tgxm.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.lc.tgxm.R;


/**
 * ClearDialog 浏览记录 清空确认弹窗
 * Created by Lei on 2018/2/27.
 */
public class ClearDialog extends BaseDialog implements View.OnClickListener {
    private OnItemClick onItemClick;

    public void setOnItemClick(OnItemClick onItemClick) {
        this.onItemClick = onItemClick;
    }

    public ClearDialog(Context context) {
        super(context);
        setContentView(R.layout.dialog_clear);

        findViewById(R.id.tv_ok).setOnClickListener(this);
        findViewById(R.id.tv_cancel).setOnClickListener(this);

    }

    public void setTitlename(int resid) {
        ((TextView) findViewById(R.id.tv_title)).setText(resid);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_ok:
                dismiss();
                if (onItemClick != null) {
                    onItemClick.onOkItemClick(v);
                }
                break;
            case R.id.tv_cancel:
                dismiss();
                break;
        }
    }

    public interface OnItemClick {
        void onOkItemClick(View v);
    }
}